import java.util.LinkedList;
import java.util.ListIterator;

public class Test {
    public static void main(String[] args) {
        MyLinkedList list=new MyLinkedList();
        list.addFirst(10);
        list.addFirst(20);
        list.addFirst(30);
        list.addFirst(40);
        list.addLast(0);
        list.addLast(-10);
        list.addIndex(3,100);
        list.remove(30);
        if(list.contains(20)){
            System.out.println("链表包含：20");
        }
        else{
            System.out.println("链表不包含：20");
        }
        list.display();

       /* LinkedList<Integer> list = new LinkedList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        System.out.println(list);
        System.out.println("=====");
        for(Integer x: list) {
            System.out.print(x+" ");
        }
        System.out.println();
        System.out.println("=====");
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+" ");
        }
        System.out.println();
        System.out.println("=====");
        ListIterator<Integer> it =  list.listIterator();
        while (it.hasNext()) {
            System.out.print(it.next()+" ");
        }
        System.out.println();

        System.out.println("==反向===");
        ListIterator<Integer> it2 =  list.listIterator(list.size());
        while (it2.hasPrevious()) {
            System.out.print(it2.previous()+" ");
        }
        System.out.println();*/
    }

}
